package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;


public class SpIncidentEditServiceAddressPageUtil extends SeleniumPageUtil {

	public final static By IESA_LINK_SAVE = By.id("IncAddress1_btnSave");
	public final static By IESA_TD_ADDRESS = By.xpath("//*[@id='IncAddress1_trAddr']/td[1]");
	public final static By IESA_SELECT_ADDRESS = By.id("IncAddress1_cboAddressID");
	public final static By IESA_LINK_NEW_ADDRESS = By.id("IncAddress1_btnAddressNew");
	public final static By IESA_LINK_EDIT_ADDRESS = By.id("IncAddress1_btnAddressEdit");
	public final static By IESA_TD_ADDRESS_DEL = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[4]/tbody/tr[2]/td[2]");
	public final static By IESA_TD_WAREHOUSE = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[4]/tbody/tr[3]/td[1]");
	public final static By IESA_INPUT_WAREHOUSE = By.id("IncAddress1_txtWarehouse");
	
	/** Wait for tab page to load. Need to make sure that before this calling, 
	 * the Service Address tab is clicked. */
	public static void waitForPageToLoad() {
		SeleniumUtil.waitOnElements(new By[]{
			IESA_SELECT_ADDRESS, IESA_LINK_NEW_ADDRESS, IESA_LINK_EDIT_ADDRESS, 
			IESA_TD_WAREHOUSE, IESA_INPUT_WAREHOUSE
		});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IESA_SELECT_ADDRESS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IESA_TD_WAREHOUSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IESA_INPUT_WAREHOUSE));
	}
}
